<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<link href="css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css">					<!-- zTree CSS函式庫 -->
<link href="css/redmond/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" type="text/css">	<!-- jquery UI CSS函式庫 -->
<link href="css/selfTemplate.css" rel="stylesheet" type="text/css">							<!-- 自建CSS函式庫 -->

<script src="js/jquery-1.10.2.min.js" type="text/javascript"></script>								<!-- jquery 函式庫 -->
<script src="js/jquery-ui-1.10.3.custom.js" type="text/javascript"></script>					<!-- jquery UI 函式庫 -->
<script src="js/jquery.cookie.js" type="text/javascript"></script>								<!-- 操做cookie用 -->
<script src="js/jquery.ztree.core-3.5.min.js" type="text/javascript"></script>						<!-- zTree 的核心函式庫，選擇SVN用 -->
<script src="js/jquery.ztree.excheck-3.5.min.js" type="text/javascript"></script>				<!-- zTree 的延伸函式庫，選擇SVN用 -->
<script src="js/widgets.js" type="text/javascript"></script>									<!-- 自建函式庫 -->


<style type="text/css">
	div#mainDiv {
		width: 60%; 
		padding-top:20px;
		padding-buttom:20px; 
		padding-right:20px;
		padding-left:15px; 
		
	}
</style>

<script type="text/javascript">



$(document).ready(function(){
	
	init("QueryDep_Memphis.html");
	
	
	$("#btnSubmit").bind("click", function(){
		clearErrorMsg();
	/* 	windowFreeze();
		 */
		$.ajax({ type:'post',url:"QueryDepRecordMemphis",dataType:'json',async:false,
			success : function(reses) {
				if ( reses.length > 0 ) {
					$("#queResRoot").html("<table id='tableQueryDepMemphis'><thead class='tableFirst'><tr><td class='left' rowspan='2' colspan='8'>※&nbsp;<label class='gb'>綠色粗體</label>表示為推測值</td><td colspan='2'>&nbsp;</td></tr><tr><td class='right' colspan='2'><a href='GenQueryMemphisReport' class='fileDownloadPromise'>下載查詢結果</a></td></tr><tr><th>#</th><th>部署記錄ID</th><th>部署人員</th><th>部署日期</th><th>部署細項ID</th><th>SQUAD</th><th>部署/下線</th><th>檔案名稱</th><th>版次</th><th>是否成功</th> </tr><tbody id='tbodyQueryDepMemphis'></tbody></table>");
					
					$.each(reses, function(i,res) {
						var bgc = (i%2==1)?"#EAF4FD":"white";
						var depType = "重新";
						var fileVer = "<label class='gb'>"+res.fileVer+"</label>";
						if ( res.depType == "1" ) {
							if( res.isDep ) {
								depType = "部署";
								fileVer = res.fileVer;
							} else {
								depType = "下線";
							}
						} else {
							if( res.isDep ) {
								depType += "部署";
							} else {
								depType = "暫時下線";
							}
						}
						
						var tmp = "<tr bgcolor='"+bgc+"'><td class='int tdr"+res.depMemphisSN+"'>"+(i+1)+"</td><td class='int tdr"+res.depMemphisSN+"'>"+res.depMemphisSN+"</td><td class='left tdr"+res.depMemphisSN+"'>"+res.creator+"</td><td class='left tdr"+res.depMemphisSN+"'>"+res.cDT+"</td><td class='int'>"+res.depMemphisDetailId+"</td><td class='left'>"+res.squadId+"</td><td class='center'>"+depType+"</td><td title='"+(res.relativePath==(""||res.fileName)?"根目錄":res.relativePath)+"' class='left'>"+res.fileName+"</td><td class='int'>"+fileVer+"</td><td title='"+res.errMsg.replace(new RegExp('\'', 'g'), "~")+"' class='center'>"+res.isSuccess+"</td></tr>";
						$("#tbodyQueryDepMemphis").append(tmp);
						
						if( res.detailSize != 1 ) {
							$(".tdr"+res.depMemphisSN).attr("rowspan",res.detailSize).attr("title",res.svnUSR+"|||"+res.svnURL);
						}
						$.each(res.dmds, function(j,dmd) {
							var depType = "重新";
							var fileVer = "<label class='gb'>"+dmd.fileVer+"</label>";
							if ( res.depType == "1" ) {
								if( dmd.isDep ) {
									depType = "部署";
									fileVer = dmd.fileVer;
								} else {
									depType = "下線";
								}
							} else {
								if( dmd.isDep ) {
									depType = "重新部署";
								} else {
									depType = "下線";
								}
							}
							
							tmp = "<tr bgcolor='"+bgc+"'><td class='int'>"+dmd.depMemphisDetailId+"</td><td class='left'>"+dmd.squadId+"</td><td class='center'>"+depType+"</td><td title='"+(dmd.relativePath==(""||dmd.fileName)?"根目錄":dmd.relativePath)+"' class='left'>"+dmd.fileName+"</td><td class='int'>"+fileVer+"</td><td title='"+dmd.errMsg+"' class='center'>"+dmd.isSuccess+"</td></tr>";
							$("#tbodyQueryDepMemphis").append(tmp);
						});
					});
					
					$("#tbodyQueryDepMemphis").tooltip();
					
				} else {
					$("#queResRoot").html("");
					$("#errShortMsg").html("沒有查詢到結果");
				}
			}, error : function(xhr, ajaxOptions, thrownError) { errorAjx(xhr); }
		});
		
/* 		windowUnfreeze(); */
	});
	
	$("button").button();
});

</script>
</head>
<body>
	<div id="header"></div>		<!-- 畫面抬頭 -->

	<div id="mainDiv" >
		<table id="tableQueryCriDepMemphis">
			<thead class="tableFirst">
				<!-- <tr><th class="right">預設查詢天數</th><td><input size="2" class="int" value="15" type="text" id="queryInterval" />天內</td></tr> -->
				<tr><td class="center" colspan="2"><button id="btnSubmit" type="button">送出</button></td></tr>
				<tr><td colspan="2">&nbsp;</td></tr>
			</thead>
		</table>
		<p>
		<div id="queResRoot"></div>
	</div>
	<p><p>
</body>
</html>